// JavaScript Document
$(function(){
	$.getJSON("/home/banner/", function(data) {
		for (var i = 0; i < data.id.length; i++) {
			$('#home-banner ul').append('<li><a href="#tab-banner-'+data.id[i]+'"><img src="'+data.thumb[i]+'" /></a></li>');
		}
		$('#home-banner ul').append('<div style="clear:both"></div>');
		for (var i = 0; i < data.id.length; i++) {
			$('#home-banner').append('<div id="tab-banner-'+data.id[i]+'"><div id="banner-'+data.id[i]+'"></div></div>');
		}
			$('#home-banner').append('<div style="clear:both"></div>');
		for (var i = 0; i < data.id.length; i++) {
			swfobject.embedSWF(data.url[i],'banner-'+data.id[i],"595", "280", "9.0.0", "/scripts/swfobject/expressInstall.swf",{},{'wmode':'transparent'});
		}
		$('#home-banner').tabs({fx:{opacity: 'toggle'}}).tabs("rotate",15000);
	});
	
	//   $('#product-tab').tabs({fx:{opacity: 'toggle'}});
	var scrollPane = $(".scroll-pane"),scrollContent = $(".scroll-content");
	scrollPane.css( "overflow", "hidden" );
	$( ".scroll-bar" ).slider({
		slide: function( event, ui ) {
			if ( scrollContent.width() > scrollPane.width() ) {
				scrollContent.css( "margin-left", Math.round(ui.value / 100 * ( scrollPane.width() - scrollContent.width() )) + "px" );
			} else {
				scrollContent.css( "margin-left", 0 );
			}
		}
	});			 

})